package com.itheima.tlias84.service.impl;

import com.itheima.tlias84.annotation.Log;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.tlias84.dto.SelectLogDTO;
import com.itheima.tlias84.entity.OperateLog;
import com.itheima.tlias84.mapper.LogMapper;
import com.itheima.tlias84.service.LogService;
import com.itheima.tlias84.utils.ResultUtil;
import com.itheima.tlias84.vo.PageVO;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 日志业务层实现类
 */
@Service
public class LogServiceImpl implements LogService {
    @Resource
    LogMapper logMapper;

    @Override
    public ResultUtil selectLogAll(Integer page, Integer pageSize) {
        Page<Object> startPage = PageHelper.startPage(page, pageSize);
        List<SelectLogDTO> list = logMapper.selectLogAll(page, pageSize);
        PageVO<SelectLogDTO> pageVO = new PageVO<>();
        pageVO.setTotal(startPage.getTotal());
        pageVO.setRows(list);
        return ResultUtil.success(pageVO);
    }
}
